package com.ywjt.pinkelephant.dynamic.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.stx.xhb.xbanner.XBanner;
import com.ywjt.pinkelephant.R;
import com.ywjt.pinkelephant.base.BaseActivity;
import com.ywjt.pinkelephant.dynamic.adapter.DynamicLiveAdapter;
import com.ywjt.pinkelephant.dynamic.adapter.PodCastDetailAdapter;
import com.ywjt.pinkelephant.dynamic.model.MenauModel;

import java.util.ArrayList;
import java.util.List;

public class ActivityPodcastDetail extends BaseActivity implements View.OnClickListener {
    private PodCastDetailAdapter jiangAdapter;
    private RecyclerView rcCommon;
    private List<MenauModel> data;

    private XBanner banner;
    private List<Integer> banners;


    public static void actionStart(Context context ) {
        Intent intent = new Intent(context, ActivityPodcastDetail.class);
        context.startActivity(intent);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){

        }
    }

    @Override
    protected void init(Bundle savedInstanceState) {
        setAndroidNativeLightStatusBar(true);
    }

    @Override
    protected int setLayoutResourceID() {
        return R.layout.activity_podcast_detail;
    }

    @Override
    protected void initView() {
        setTitleText("播客有你");
        banner=findViewById(R.id.banner);
        rcCommon=findViewById(R.id.rcCommon);
        banners=new ArrayList<>();
        banners.add(R.mipmap.icon_banner);
        banners.add(R.mipmap.icon_banner);
        banners.add(R.mipmap.icon_banner);
        banners.add(R.mipmap.icon_banner);
        banner.setData(R.layout.item_banner1,banners,null);
        banner.loadImage(new XBanner.XBannerAdapter() {
            @Override
            public void loadBanner(XBanner banner, Object object, View view, int position) {
                RelativeLayout container=(RelativeLayout) view;
                ImageView ivBanner=container.findViewById(R.id.ivBanner);
                Glide.with(ActivityPodcastDetail.this).load(banners.get(position))
                        .apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
                        .into(ivBanner);
            }
        });

        data=new ArrayList<>();
        data.add(new MenauModel("抖音直播间",R.mipmap.icon_douyin));
        data.add(new MenauModel("快手直播间",R.mipmap.icon_kuaishou));
        data.add(new MenauModel("视频号直播",R.mipmap.icon_shipinhao));
        jiangAdapter=new PodCastDetailAdapter(data);
        rcCommon.setLayoutManager(new GridLayoutManager(ActivityPodcastDetail.this,3,RecyclerView.VERTICAL,false));
        rcCommon.setAdapter(jiangAdapter);
    }

    @Override
    protected void initData() { }

    /**
     * 获取要使用的标题栏样式(此函数由子类重写)
     * @return
     */
    @Override
    protected int getTitleBarType() {
        return 0;
    }

}
